package com.wxq.product.redission;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.redisson.config.SingleServerConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Jim
 * @date 2:43 上午 2022/4/6
 * @description Redisson配置
 * @email:huwmz04153277@126.com
 */
@Configuration
public class RedissonConfig {

//    @Value("${spring.redis.host}")
//    private String host;

//    @Value("${spring.redis.password}")
//    private String password;

    @Bean(destroyMethod = "shutdown",name = "redissionClient")
    public RedissonClient redissonClient(){
        Config config = new Config();
        SingleServerConfig singleServerConfig = config.useSingleServer();
        singleServerConfig.setAddress("redis://localhost:6379");
    //    singleServerConfig.setPassword("root");
        return Redisson.create(config);

    }
}
